using System;
using System.Runtime.Serialization;
using System.Security.Permissions;

namespace MizExceptions
{
	/// <summary>
	/// User entered a wrong username or password in the login screen
	/// </summary>
	public class InvalidUserCredentialsException: System.ApplicationException
	{
		public InvalidUserCredentialsException(string message):
		base(message)
		{
        }

		public InvalidUserCredentialsException():
			base("Invalid user name or password.")
		{
		}
	}

    [Serializable]
	public class UserAlreadyExistsException: System.ApplicationException
	{

		public UserAlreadyExistsException():
			base("This user already exists. Please use another user name.")
		{
		}

		public UserAlreadyExistsException(string message):
			base(message)
		{
		}
                /// <summary>
        /// needed for remoting.
        /// http://www.ddj.com/184405850#l8
        /// </summary>
        protected UserAlreadyExistsException(SerializationInfo info, StreamingContext context) 
            : base(info, context)
        {
            // If exception has additional fields, they should be deserialized here. eg,            data = info.GetString("Data");
        }
	}

	
	public class ServerUnavailableException: System.ApplicationException
	{
		public ServerUnavailableException(string message):
			base(message)
		{
		}

        public ServerUnavailableException()
            :
			base("The mizaniya service cannot be found.")
		{
		}
	}

	public class ConfigFileNotFoundException: System.ApplicationException
	{
		public ConfigFileNotFoundException():
			base("The configuration file was not found.")
		{
		}
		public ConfigFileNotFoundException(string message):
			base(message)
		{
		}
	}

	public class DataBaseFileNotFoundException: System.ApplicationException
	{
		public DataBaseFileNotFoundException():
			base("The XML database file was not found.")
		{
		}
		public DataBaseFileNotFoundException(string message):
			base(message)
		{
		}
	}

	public class CashAccountExistsException: System.ApplicationException
	{
		public CashAccountExistsException():
			base("You can not have more than one cash account")
		{
		}
		public CashAccountExistsException(string message):
			base(message)
		{
		}
	}

	
	public class AccountAlreadyExistException: System.ApplicationException
	{
		public AccountAlreadyExistException():
			base("The Account you want to create already exist")
		{
		}
		public AccountAlreadyExistException(string message):
			base(message)
		{
		}
	}
	
	

	public class UserNotLoggedInException: System.ApplicationException
	{
		public UserNotLoggedInException():
			base("The Account you want to create already exist")
		{
		}
		public UserNotLoggedInException(string message):
			base(message)
		{
		}
	}

	
}
